﻿Imports System.Data.SqlClient

Public Class DangNhap

    'Private Sub btnDoiPass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    'End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        Me.Close()
    End Sub

    Private Sub btnDangNhap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDangNhap.Click
        DataProvider.CreateConnectionStringFromXml(Application.StartupPath + "\InfoDataBaseServer.xml")

        Dim str As String = "select MaUser from [User] where MaUser = '" & txtUserName.Text.Trim & "' and MatKhau = '" & txtPassWord.Text.Trim & "'"
        Dim dt As New DataTable
        dt = ProcFunc.ExecuteFuncSQL(str)
        If dt.Rows.Count > 0 Then
            Me.Hide()
            Bien._user = dt.Rows(0)(0).ToString()
            Dim frm As New TrangChu
            frm.ShowDialog()
        Else
            MessageBox.Show("Tên đăng nhập hoăc mật khẩu sai. Xin vui lòng nhập lại")
            Return
        End If

    End Sub

    Private Sub DangNhap_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
